<?php

namespace Addons\Adfloat\Controller;
use Home\Controller\AddonsController;

class AdfloatController extends AddonsController{
    public function index(){
        $res =I('post.');
        //var_dump($res);
        if( !M('xfimage')->select()){
            $a=M('xfimage')->add($res);
            if($a){

                $this->success('保存成功');

            }else{

                $this->error('保存出错');

            }
        }else{
            $id=M('xfimage')->field('id')->find();
            $id=$id['id'];
            $a=M('xfimage')->where('id='.$id)->save($res);
            if($a == 1){

                $this->success('保存成功');

            }elseif ($a == 0){

                $this->success('保存成功');

            }else{
                $this->error('保存失败');
            }
        }

    }

    public function so(){
        echo json_encode(array('1'));
    }
}
